<script setup lang="ts">
	import { playDescApi } from '@/api/peiwan'
	import { ref, watch } from 'vue'
	import { fullUrl, getPayPageUrl } from '@/utils/common'
	import { onShow,onLoad } from '@dcloudio/uni-app'
	import { usePupupStore } from '@/stores'
	import { pageUrl } from '@/utils/constants'
	
	const dataList = ref([])
	const queryList = (id: number) => {
	    playDescApi(id).then((res) => {
		   console.log('999999',res)
		   /*
	       res.result.data.map((item) => {
	        console.log('888888',item);
	       })
		   dataList.value = res.result.data;
		   console.log('33333',dataList.value);
		   */
	    })
	 }
	 const toDetail = (id: number) => {
		 uni.navigateTo({
		 	url: pageUrl['dingdanDesc'] + '?id='+ id
		 })
	 }
	 
	 onLoad((options) => {
	     queryList(parseInt(options.id))
	 })
	 
	 const backToTop = ref(true)
	 watch(
	   () => usePupupStore().showCancelPopup,
	   (newVal) => {
	     backToTop.value = !newVal
	   },
	   { immediate: true },
	 )
</script>
<template>
	<view style="padding:20rpx;">
		<view style="width:100%;background-color: #ffffff;border-radius: 20px;height:200px;padding:10px;margin:20px 0;overflow: hidden;" v-for="(item,index) in dataList" :key="index">
			 <view style="width:100%;height:20px;display:flex;flex-wrap: wrap;color:#999;justify-content: space-between;">
				 <text>{{item.create_time}}</text>
				 <text>待接单</text>
			 </view>
			 <view style="display:flex;flex-wrap:wrap;width:100%;height:100px;margin-top:5px;">
				 <image :src="fullUrl(item.detail[0].image)" mode="aspectFill" style="width:100px;height:100px;"></image>
				 <view style="width:60%;height:90px;margin:10px;">
					 <view style="height:60px;overflow: hidden;">{{item.detail[0].goods_name}}</view>
					 <view style="display: flex; flex-wrap: wrap;justify-content: space-between;"><text>实付：{{item.detail[0].price}}</text><text>数量：{{item.total_num}}</text></view>
				 </view>
			 </view>
			 <view style="width:92%;padding-top:15px;">
				 <button style="background-color:#f00;float:right;width:100px;color:#ffffff;font-size:14px;height:25px;line-height: 25px;border-radius: 20px;" @tap="toDetail(item.id)">立即抢单</button>
			 </view>
		</view>
	</view>
</template>

<style>
   page {
     background-color: #f6f6f6;
   }
</style>